设置底部标题点击时的颜色
1
2
3
4
5[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
UIColor *titleHighlightedColor = [UIColor whiteColor];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:titleHighlightedColor, NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];
设置tabbar选中颜色
iOS7设置如下:
1 | [self.tabBarController.tabBarsetSelectedImageTintColor:[UIColor greenColor]]; |
ios8中如下设置:
1 | self.tabBar.tintColor=[UIColor greenColor]; |
消除tabbar边框
在appdelegate的程序启动处:
1 |
|
设置tabbar item原始图标与原始选中图标,而不是系统自动填充的颜色
1 | // 拿到 TabBar 在拿到想应的item |
设置tabbar背景图片
1 | UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Main_Screen_Width, 49)]; |